home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / Sample Code / Typography Samples / Dave’s Fab Samples ƒ / Vertical Substitution.c < prev   
Encoding:
C/C++ Source or Header  |  1996-05-05  |  1.8 KB  |  79 lines  |  [TEXT/KAHL]

  1. #include <Types.h>
  2. #include <QuickDraw.h>
  3. #include <Fonts.h>
  4. #include <Windows.h>
  5. #include <Menus.h>
  6. #include <SegLoad.h>
  7. #include <Memory.h>
  8. #include <Desk.h>
  9.  
  10. #include <GXGraphics.h>
  11. #include "GraphicsLibraries.h"
  12. #include <GXEnvironment.h>
  13.  
  14. #include <GXTypes.h>
  15. #include <GXLayout.h>
  16. #include "LayoutLibrary.h"
  17. #include "LayoutFeatureConstants.h"
  18.  
  19. #include "SampleInterface.h"
  20.  
  21. short MyStrLen(char *x);
  22. static short MyStrLen(x)
  23. char    *x;
  24.     {
  25.     short c = 0;
  26.     while (*x++) c++;
  27.     return c;
  28.     }    /* MyStrLen */
  29.  
  30. void VerticalSubstitution(WindowPtr sampleWindow)
  31.     {
  32.     /* Variables */
  33.     char            *myString = "(note change)";
  34.     gxLayoutOptions    gxLayoutOptions;
  35.     gxPoint            myPoint;
  36.     gxRunFeature        gxRunFeature;
  37.     gxShape            layout;
  38.     short            len, level = 0;
  39.     gxStyle            myStyle;
  40.     gxViewPort        aViewPort;
  41.     
  42.     /* Initialization */
  43.     
  44.     myPoint.x = ff(20);
  45.     myPoint.y = ff(50);
  46.     
  47.     aViewPort = GXNewWindowViewPort(sampleWindow);
  48.     SetDefaultViewPort(aViewPort);
  49.     
  50.     len = MyStrLen(myString);
  51.     InitializeLayoutOptions(&gxLayoutOptions);
  52.     
  53.     myStyle = NewLayoutStyle((char *) "\pvsTimes Roman", ff(40), 0, nil, nil, 0, nil);
  54.     
  55.     layout = GXNewLayout(
  56.         1, &len, (void *) &myString,
  57.         1, &len, &myStyle,
  58.         1, &len, &level,
  59.         &gxLayoutOptions, &myPoint);
  60.     GXDrawShape(layout);
  61.  
  62.     GXRotateShape(layout, ff(90), ff(0), ff(0));
  63.     gxRunFeature.featureType = verticalSubstitutionType;
  64.     gxRunFeature.featureSelector = verticalSubstitutionOffSelector;
  65.     GXSetStyleRunFeatures(myStyle, 1, &gxRunFeature);
  66.     GXSetStyleTextAttributes(myStyle, gxVerticalText);
  67.     GXMoveShape(layout, ff(80), ff(60));
  68.     GXDrawShape(layout);
  69.     
  70.     gxRunFeature.featureSelector = verticalSubstitutionOnSelector;
  71.     GXSetStyleRunFeatures(myStyle, 1, &gxRunFeature);
  72.     GXMoveShape(layout, ff(150), 0);
  73.     GXDrawShape(layout);
  74.     
  75.     GXDisposeShape(layout);
  76.     GXDisposeStyle(myStyle);
  77.     GXDisposeViewPort(aViewPort);
  78.     }    /* main */
  79.